# -*- coding: utf-8 -*-
import pygame
pygame.init()
from sys import exit
from pygame.locals import *

show_menu = True

def quit(pressed_keys):
	
	if pressed_keys[K_ESCAPE]:
		exit()

def yes_no(pressed_keys):
	if pressed_keys[K_y]:
		global show_menu
		show_menu = False
	if pressed_keys[K_n]:
		exit()


def take_input():
	pressed_keys = pygame.key.get_pressed()
	quit(pressed_keys)
	yes_no(pressed_keys)

def gameover_screen(screen,score):
	font = pygame.font.SysFont("arial", 40)
	score_font = pygame.font.SysFont("arial", 35)
	outline = Rect((100,150),(400,200))
	box = Rect((110,160),(380,180))
	pressed_keys = pygame.key.get_pressed()
	while show_menu == True:
		event = pygame.event.poll()
		if event.type == QUIT:
			exit()
		take_input()
			
		pygame.draw.rect(screen,(255,255,255),outline)
		pygame.draw.rect(screen,(0,0,0),box)
		screen.blit(font.render("GAME OVER", True, (250, 250, 250)), (160, 170) )
		screen.blit(score_font.render("You scored %i points" % score, True, (250, 250, 250)), (115, 230) )
		screen.blit(font.render("Play again? y/n", True, (250, 250, 250)), (155, 290) )
		pygame.display.update()
	global show_menu
	show_menu = True
	return True